<template>
  <div>
    <!-- 三级联动分类组件 -->
    <TypeNav></TypeNav>
    <!-- 轮播图列表组件 -->
    <ListContainer></ListContainer>
    <!-- 今日推荐组件 -->
    <ReCommend></ReCommend>
    <!-- 商品排行 -->
    <Rank></Rank>
    <!-- 猜你喜欢 -->
    <Like></Like>
    <!-- 楼层 -->
    <Floor :floordata="floor" v-for="floor in floorList" :key="floor.id"></Floor>
    <!-- 商标 -->
    <Brand></Brand>
  </div>
</template>

<script>
// 导入组件
import ListContainer from "@/pages/Home/ListContainer";
import ReCommend from "@/pages/Home/ReCommend";
import Rank from "@/pages/Home/Rank";
import Like from "@/pages/Home/Like";
import Floor from "@/pages/Home/Floor";
import Brand from "@/pages/Home/Brand";
import { mapState } from "vuex";

export default {
  name: "",
  components: {
    ListContainer,
    ReCommend,
    Rank,
    Like,
    Floor,
    Brand,
  },
  mounted() {
    // 调用Vuex中action的方法，发起请求，获取数据并存储到数据仓库中
    this.$store.dispatch("getFloorList")
    // // 用户登录后获取用户信息在首页展示
    // this.$store.dispatch("getUserInfo")
  },
  computed: {
    ...mapState({
        floorList: state => state.home.floorList
    })
  }
};
</script>

<style>
</style>